home *** CD-ROM | disk | FTP | other *** search
Turbo C Context File | 1992-01-17 | 38.8 KB | 977 lines |
- Turbo C Context File
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- TVINPUT.CPP
- TSTRINP.CPP
- *.HPP
- *.CPP
- ofHaveInput
- ofMandInput
- left,D
- right
- right,D
- string
- D:\BC\TV\INCLUDE\MSGBOX.H
- D:\BC\TV\TVGAS\GASCALC.CPP
- D:\BC\TV\TSTRINP\TVINPUT.CPP
- D:\BC\TV\TSTRINP\TSTRINP.HPP
- D:\BC\TV\TSTRINP\TSTRINP.CPP
- _ &TFormApp::initMenuBar,
- &TFormApp::initDeskTop)
- TEvent event;
- // Display about box
- event.what = evCommand;
- event.message.command = cmAboutBox;
- putEvent(event);
- void TFormApp::changeDir()
- TView *d = validView( new TChDirDialog( 0, hlChangeDir ) );
- if( d != 0 ) {
- deskTop->execView( d );
- destroy(d);
- }
- void TFormApp::dosShell()
- suspend();
- system("cls");
- cout << "Type EXIT to return...";
- system( getenv( "COMSPEC"));
- resume();
- redraw();
- void TFormApp::openListDialog()
- TFileDialog *d;
- char *fileName;
- TDialog *listEditor;
- char errorMsg[MAXSIZE];
- extern Boolean fileExists( char *);
- char name[MAXFILE];
- char drive[MAXDRIVE];
- char dir[MAXDIR];
- char ext[MAXEXT];
- d = new TFileDialog("*.TVF", "Open File",
- "~N~ame", fdOpenButton, hlOpenListDlg);
- if (validView(d) != NULL)
- {
- if (deskTop->execView(d) != cmCancel)
- {
- fileName = new char[MAXPATH];
- d->getFileName(fileName);
- if (!fileExists(fileName))
- {
- strcpy(errorMsg, "Cannot find file ");
- strcat(errorMsg, fileName);
- messageBox(errorMsg, mfError | mfOKButton);
- }
- else
- {
- // If listEditor exists, select it; otherwise, open new one
- fnsplit(fileName, drive, dir, name, ext);
- listEditor = (TDialog *)message(deskTop, evBroadcast, cmEditingFile, fileName);
- if (listEditor == NULL)
- deskTop->insert(validView(new TListDialog(fileName, name)));
- else listEditor->select();
- }
- delete fileName;
- }
- destroy(d);
- }
- void TFormApp::handleEvent(TEvent& event)
- ushort newMode;
- char aboutMsg[80];
- TApplication::handleEvent(event);
- if (event.what == evCommand)
- {
- switch (event.message.command)
- {
- case cmListOpen:
- openListDialog();
- break;
- case cmChgDir:
- changeDir();
- break;
- case cmDosShell:
- dosShell();
- break;
- case cmAboutBox:
- strcpy(aboutMsg, "\x3Turbo Vision C++ 1.0\n\n\x3Turbo Vision Forms Demo");
- messageBox(aboutMsg, mfInformation | mfOKButton);
- break;
- case cmVideoMode:
- newMode = TScreen::screenMode ^ TDisplay::smFont8x8;
- if ((newMode & TDisplay::smFont8x8) != 0)
- shadowSize.x = 1;
- else
- shadowSize.x = 2;
- setScreenMode(newMode);
- break;
- default:
- return;
- }
- clearEvent(event);
- }
- TMenuBar *TFormApp::initMenuBar( TRect r)
- r.b.y = r.a.y + 1;
- return new TMenuBar(r,
- *new TSubMenu( "~\xF0~", hcNoContext ) +
- *new TMenuItem( "~V~ideo mode", cmVideoMode, kbNoKey, hcNoContext, "" ) +
- newLine() +
- *new TMenuItem( "~A~bout...", cmAboutBox, kbNoKey, hcNoContext ) +
- *new TSubMenu( "~F~ile", hcNoContext) +
- *new TMenuItem( "~O~pen...", cmListOpen, kbF3, hcNoContext, "F3" ) +
- *new TMenuItem( "~S~ave", cmListSave, kbF2, hcNoContext, "F2" ) +
- newLine() +
- *new TMenuItem( "~C~hange directory...", cmChgDir, kbNoKey, hcNoContext ) +
- *new TMenuItem( "~D~OS shell", cmDosShell, kbNoKey, hcNoContext ) +
- *new TMenuItem( "E~x~it", cmQuit, kbAltX, hcNoContext, "Alt-X" ) +
- *new TSubMenu( "~W~indow", hcNoContext ) +
- *new TMenuItem( "~M~ove", cmResize, kbCtrlF5, hcNoContext, "Cntl-F5") +
- *new TMenuItem( "~N~ext", cmNext, kbF6, hcNoContext, "F6") +
- *new TMenuItem( "~P~rev", cmPrev, kbShiftF6, hcNoContext, "Shift-F6") +
- *new TMenuItem( "~C~lose", cmClose, kbAltF3, hcNoContext, "Alt-F3")
- );
- TStatusLine *TFormApp::initStatusLine( TRect r )
- r.a.y = r.b.y - 1;
- return new TStatusLine( r,
- *new TStatusDef( 0, 0xFFFF ) +
- *new TStatusItem( "~F2~ Save", kbF2, cmListSave ) +
- *new TStatusItem( "~F3~ Open", kbF3, cmListOpen ) +
- *new TStatusItem( "~F10~ Menu", kbF10, cmMenu) +
- *new TStatusItem( "", kbCtrlF5, cmResize )
- );
- int main()
- TFormApp formApp;
- formApp.run();
- return 0;
- char *msg = " Prompt for...";
- TDialog *d = new TDialog(TRect(0, 0, 30, 12), "Input form options");
- d->options |= ofCentered;
- d->insert(new TStaticText(TRect(2, 2, 17, 3), msg));
- TView *v = new TCheckBoxes(TRect(2, 3, 28, 7),
- new TSItem("~O~il changes",
- new TSItem("~T~une-ups",
- new TSItem("~S~park plug changes",
- new TSItem("Oi~l~ brand/type", 0)))));
- v->options |= ofFramed;
- d->insert(v);
- d->insert(new TButton(TRect(4, 9, 14, 11), "O~K~", cmOK, bfDefault));
- d->insert(new TButton(TRect(16, 9, 26, 11), "~C~ancel",
- cmCancel, bfNormal));
- d->selectNext(True);
- d->helpCtx = hcOPrefs;
- // Execute the dialog box
- execDialog(d, &boxes->init);
- char label1[] = "~I~nput files extension";
- char label2[] = "~R~eport files extension";
- char label3[] = "~D~esktop files extension";
- TInputLine *control;
- TDialog *d = new TDialog(TRect(0, 0, 32, 18), "File extensions");
- d->options |= ofCentered;
- control = new TInputLine(TRect(2, 3, 8, 4), 4);
- d->insert(control);
- d->insert(new TLabel(TRect(2, 2, 30, 3), label1, control));
- d->insert(new THistory(TRect(10, 3, 13, 4), control, hlInputExt));
- control = new TInputLine(TRect(2, 7, 8, 8), 4);
- d->insert(control);
- d->insert(new TLabel(TRect(2, 6, 30, 7), label2, control));
- d->insert(new THistory(TRect(10, 7, 13, 8), control, hlReportExt));
- control = new TInputLine(TRect(2, 11, 8, 12), 4);
- d->insert(control);
- d->insert(new TLabel(TRect(2, 10, 30, 11), label3, control));
- d->insert(new THistory(TRect(10, 11, 13, 12), control, hlDesktopExt));
- d->insert(new TButton(TRect(3, 14, 13, 16), "O~K~", cmOK, bfDefault));
- d->insert(new TButton(TRect(15, 14, 25, 16), "~C~ancel",
- cmCancel, bfNormal));
- d->selectNext(True);
- d->helpCtx = hcOPrefs;
- if(execDialog(d, exts) != cmCancel) // Execute dialog
- {
- strupr(exts->input); // Uppercase the data
- strupr(exts->report);
- strupr(exts->dsktop);
- }
- ushort execDialog(TDialog *d, void *data)
- // Execute TDialog d with setData and getData
- TView *p = TProgram::application->validView(d);
- if(p == 0)
- return cmCancel;
- else
- {
- if(data != 0)
- p->setData(data);
- ushort result = TProgram::deskTop->execView(p);
- if(result != cmCancel && data != 0)
- p->getData(data);
- TObject::destroy(p);
- return result;
- }
- messageBox("Couldn't open help file", mfError | mfOKButton);
- options |= ofSelectable | ofFirstClick;
- int dec, sign, ndig = 5;
- ndig, &dec, &sign);
- virtual void handleEvent( TEvent& event );
- void TInputLine::handleEvent( TEvent& event )
- TView::handleEvent(event);
- int delta, anchor, i;
- if( (state & sfSelected) != 0 )
- switch( event.what )
- {
- case evMouseDown:
- if( canScroll(delta = mouseDelta(event)) )
- do {
- if( canScroll(delta) )
- {
- firstPos += delta;
- drawView();
- }
- } while( mouseEvent( event, evMouseAuto ) );
- else if (event.mouse.doubleClick)
- selectAll(True);
- else
- {
- anchor = mousePos(event);
- do {
- if( event.what == evMouseAuto &&
- canScroll( delta = mouseDelta(event) )
- )
- firstPos += delta;
- curPos = mousePos(event);
- if( curPos < anchor )
- {
- selStart = curPos;
- selEnd = anchor;
- }
- else
- {
- selStart = anchor;
- selEnd = curPos;
- }
- drawView();
- } while (mouseEvent(event, evMouseMove | evMouseAuto));
- }
- clearEvent(event);
- break;
- case evKeyDown:
- switch( ctrlToArrow(event.keyDown.keyCode) )
- {
- case kbLeft:
- if( curPos > 0 )
- curPos--;
- break;
- case kbRight:
- if( curPos < strlen(data) )
- curPos++;
- break;
- case kbHome:
- curPos = 0;
- break;
- case kbEnd:
- curPos = strlen(data);
- break;
- case kbBack:
- if( curPos > 0 )
- {
- strcpy( data+curPos-1, data+curPos );
- curPos--;
- if( firstPos > 0 )
- firstPos--;
- }
- break;
- case kbDel:
- if( selStart == selEnd )
- if( curPos < strlen(data) )
- {
- selStart = curPos;
- selEnd = curPos + 1;
- }
- deleteSelect();
- break;
- case kbIns:
- setState(sfCursorIns, Boolean(!(state & sfCursorIns)));
- break;
- default:
- if( event.keyDown.charScan.charCode >= ' ' )
- {
- if( (state & sfCursorIns) != 0 )
- strcpy( data + curPos, data + curPos + 1 );
- else
- deleteSelect();
- if( strlen(data) < maxLen )
- {
- if( firstPos > curPos )
- firstPos = curPos;
- memmove( data + curPos + 1, data + curPos,
- strlen(data+curPos)+1 );
- data[curPos++] =
- event.keyDown.charScan.charCode;
- }
- }
- else if( event.keyDown.charScan.charCode == CONTROL_Y)
- {
- *data = EOS;
- curPos = 0;
- }
- else
- return;
- }
- selStart = 0;
- selEnd = 0;
- if( firstPos > curPos )
- firstPos = curPos;
- i = curPos - size.x + 3;
- if( firstPos < i )
- firstPos = i;
- drawView();
- clearEvent( event );
- break;
- }
- if(event.what == evCommand && event.message.command == cmClose)
- __link(RInputLine)
- f(ios::showpos) ;
- f(ios::showpos) ;
- str.setf(ios::showpoint) ;
- os.setf(ios::showpoint);
- os.setf(ios::showpos);
- os.setf(ios::showpoint);
- os.setf(ios::showpos);
-
- cout.precision(1) ;
- cout.setf(ios::fixed , ios::floatfield) ;
- os.setf(ios::fixed, ios::floatfield);
- os.setf(ios::showpoint);
- os.precision(1) ;
-
- os.setf(ios::showpos);
- char buff[81];
- ostrstream os(buff, sizeof buff);
- os.setf(ios::showpoint);
- os.setf(ios::fixed, ios::floatfield);
- os.precision(1) ;
- os << *(double *)rec
- << ends;
- strcpy(data, os.str());
- os.setf(ios::showpoint);
- os.setf(ios::fixed, ios::floatfield);
- os.precision(1) ;
- os << *(double *)rec
- << ends;
- strcpy(data, os.str());
- #if !defined __VALUES_H
- #include <values.h>
- #endif
- #if !defined __IOSTREAM_H
- #include <iostream.h>
- #endif
- #if !defined __IOMANIP_H
- #include <iomanip.h>
- #endif
- #define Uses_ipstream
- #define Uses_opstream
-
- ofCentered = 0x300
- ofSelectable = 0x001
-
-
- ofTopSelect = 0x002
- Udefned
- ofFirstClick = 0x004
-
- ofFramed = 0x008
-
- ofPreProcess = 0x010
-
- ofPostProcess = 0x020
-
- ofBuffered = 0x040
-
- ofTileable = 0x080
-
- ofCenterX = 0x100
-
- ofCenterY = 0x200
- d->insert(new THistory(TRect(10, 3, 13, 4), control, hlInputExt));
- if( (state & sfSelected) != 0 )
- switch( event.what )
- {
- case evMouseDown:
- if( canScroll(delta = mouseDelta(event)) )
- do {
- if( canScroll(delta) )
- {
- firstPos += delta;
- drawView();
- }
- } while( mouseEvent( event, evMouseAuto ) );
- else if (event.mouse.doubleClick)
- selectAll(True);
- else
- {
- anchor = mousePos(event);
- do {
- if( event.what == evMouseAuto &&
- canScroll( delta = mouseDelta(event) )
- )
- firstPos += delta;
- curPos = mousePos(event);
- if( curPos < anchor )
- {
- selStart = curPos;
- selEnd = anchor;
- }
- else
- {
- selStart = anchor;
- selEnd = curPos;
- }
- drawView();
- } while (mouseEvent(event, evMouseMove | evMouseAuto));
- }
- clearEvent(event);
- break;
- case evKeyDown:
- switch( ctrlToArrow(event.keyDown.keyCode) )
- {
- case kbLeft:
- if( curPos > 0 )
- curPos--;
- break;
- case kbRight:
- if( curPos < strlen(data) )
- curPos++;
- break;
- case kbHome:
- curPos = 0;
- break;
- case kbEnd:
- curPos = strlen(data);
- break;
- case kbBack:
- if( curPos > 0 )
- {
- strcpy( data+curPos-1, data+curPos );
- curPos--;
- if( firstPos > 0 )
- firstPos--;
- }
- break;
- case kbDel:
- if( selStart == selEnd )
- if( curPos < strlen(data) )
- {
- selStart = curPos;
- selEnd = curPos + 1;
- }
- deleteSelect();
- break;
- case kbIns:
- setState(sfCursorIns, Boolean(!(state & sfCursorIns)));
- break;
- default:
- if( event.keyDown.charScan.charCode >= ' ' )
- {
- if( (state & sfCursorIns) != 0 )
- strcpy( data + curPos, data + curPos + 1 );
- else
- deleteSelect();
- if( strlen(data) < maxLen )
- {
- if( firstPos > curPos )
- firstPos = curPos;
- memmove( data + curPos + 1, data + curPos,
- strlen(data+curPos)+1 );
- data[curPos++] =
- event.keyDown.charScan.charCode;
- }
- }
- else if( event.keyDown.charScan.charCode == CONTROL_Y)
- {
- *data = EOS;
- curPos = 0;
- }
- else
- return;
- }
- selStart = 0;
- selEnd = 0;
- if( firstPos > curPos )
- firstPos = curPos;
- i = curPos - size.x + 3;
- if( firstPos < i )
- firstPos = i;
- drawView();
- clearEvent( event );
- break;
- }
- if( event.what == evMouseDown ||
- ( event.what == evKeyDown &&
- ctrlToArrow( event.keyDown.keyCode ) == kbDown &&
- (link->state & sfFocused) != 0
- )
- )
- if( event.what == evBroadcast )
- if( (event.message.command == cmReleasedFocus &&
- event.message.infoPtr == link) ||
- event.message.command == cmRecordHistory
- )
- if( event.what == evMouseDown ||
- ( event.what == evKeyDown &&
- ctrlToArrow( event.keyDown.keyCode ) == kbDown &&
- (link->state & sfFocused) != 0
- eventMask |= evBroadcast;
- class far THistoryWindow;
- if( event.what == evMouseDown ||
- ( event.what == evKeyDown &&
- ctrlToArrow( event.keyDown.keyCode ) == kbDown &&
- (link->state & sfFocused) != 0
- )
- )
- {
- link->select();
- historyAdd( historyId, link->data );
- r = link->getBounds();
- r.a.x--;
- r.b.x++;
- r.b.y += 7;
- r.a.y--;
- p = owner->getExtent();
- r.intersect( p );
- r.b.y--;
- historyWindow = initHistoryWindow( r );
- if( historyWindow != 0 )
- {
- c = owner->execView( historyWindow );
- if( c == cmOK )
- {
- char rslt[256];
- historyWindow->getSelection( rslt );
- strncpy( link->data, rslt, link->maxLen );
- link->selectAll( True );
- link->drawView();
- }
- destroy( historyWindow );
- }
- clearEvent( event );
- }
- else
- if( event.what == evBroadcast )
- if( (event.message.command == cmReleasedFocus &&
- event.message.infoPtr == link) ||
- event.message.command == cmRecordHistory
- )
- historyAdd( historyId, link->data );
- keyDown.keyCode = _AX;
- while( curRec != 0 )
- {
- if( strcmp( str, curRec->str ) == 0 )
- deleteString();
- advanceStringPointer();
- }
- event.keyDown.charScan.charCode;
- if( (state & sfSelected) != 0 )
- switch( event.what )
- for( short i = 0; i <= index; i++ )
- advanceStringPointer();
- while( curRec != 0 )
- {
- if( strcmp( str, curRec->str ) == 0 )
- deleteString();
- advanceStringPointer();
- advanceStringPointer();
- while( curRec != 0 )
- {
- if( strcmp( str, curRec->str ) == 0 )
- deleteString();
- advanceStringPointer();
- if( event.what == evMouseDown ||
- ( event.what == evKeyDown &&
- ctrlToArrow( event.keyDown.keyCode ) == kbDown &&
- (link->state & sfFocused) != 0
- )
- )
- {
- link->select();
- historyAdd( historyId, link->data );
- r = link->getBounds();
- r.a.x--;
- r.b.x++;
- r.b.y += 7;
- r.a.y--;
- p = owner->getExtent();
- r.intersect( p );
- r.b.y--;
- historyWindow = initHistoryWindow( r );
- if( historyWindow != 0 )
- {
- c = owner->execView( historyWindow );
- if( c == cmOK )
- {
- char rslt[256];
- historyWindow->getSelection( rslt );
- strncpy( link->data, rslt, link->maxLen );
- link->selectAll( True );
- link->drawView();
- }
- destroy( historyWindow );
- }
- clearEvent( event );
- }
- else
- if( event.what == evBroadcast )
- if( (event.message.command == cmReleasedFocus &&
- event.message.infoPtr == link) ||
- event.message.command == cmRecordHistory
- )
- historyAdd( historyId, link->data );
- TView::handleEvent(event);
- int delta, anchor, i;
- if( (state & sfSelected) != 0 )
- switch( event.what )
- {
- case evMouseDown:
- if( canScroll(delta = mouseDelta(event)) )
- do {
- if( canScroll(delta) )
- {
- firstPos += delta;
- drawView();
- }
- } while( mouseEvent( event, evMouseAuto ) );
- else if (event.mouse.doubleClick)
- selectAll(True);
- else
- {
- anchor = mousePos(event);
- do {
- if( event.what == evMouseAuto &&
- canScroll( delta = mouseDelta(event) )
- )
- firstPos += delta;
- curPos = mousePos(event);
- if( curPos < anchor )
- {
- selStart = curPos;
- selEnd = anchor;
- }
- else
- {
- selStart = anchor;
- selEnd = curPos;
- }
- drawView();
- } while (mouseEvent(event, evMouseMove | evMouseAuto));
-
- 1 }
- clearEvent(event);
- break;
- case evKeyDown:
- switch( ctrlToArrow(event.keyDown.keyCode) )
- {
- case kbLeft:
- if( curPos > 0 )
- curPos--;
- break;
- case kbRight:
- if( curPos < strlen(data) )
- curPos++;
- break;
- case kbHome:
- curPos = 0;
- break;
- case kbEnd:
- curPos = strlen(data);
- break;
- case kbBack:
- if( curPos > 0 )
- {
- strcpy( data+curPos-1, data+curPos );
- curPos--;
- if( firstPos > 0 )
- firstPos--;
- }
- break;
- case kbDel:
- if( selStart == selEnd )
- if( curPos < strlen(data) )
- {
- selStart = curPos;
- selEnd = curPos + 1;
- }
- deleteSelect();
- break;
- case kbIns:
- setState(sfCursorIns, Boolean(!(state & sfCursorIns)));
- break;
- default:
- if( event.keyDown.charScan.charCode >= ' ' )
- {
- if( (state & sfCursorIns) != 0 )
- strcpy( data + curPos, data + curPos + 1 );
- else
- deleteSelect();
- if( strlen(data) < maxLen )
- {
- if( firstPos > curPos )
- firstPos = curPos;
- memmove( data + curPos + 1, data + curPos,
- strlen(data+curPos)+1 );
- data[curPos++] =
- event.keyDown.charScan.charCode;
- }
- }
- else if( event.keyDown.charScan.charCode == CONTROL_Y)
- {
- *data = EOS;
- curPos = 0;
- }
- else
- return;
- }
- selStart = 0;
- selEnd = 0;
- if( firstPos > curPos )
- firstPos = curPos;
- i = curPos - size.x + 3;
- if( firstPos < i )
- firstPos = i;
- drawView();
- clearEvent( event );
- break;
- }
- #define Uses_TKeys
- TView::handleEvent(event);
- int delta, anchor, i;
- if( (state & sfSelected) != 0 )
- switch( event.what )
- {
- case evMouseDown:
- if( canScroll(delta = mouseDelta(event)) )
- do {
- if( canScroll(delta) )
- {
- firstPos += delta;
- drawView();
- }
- } while( mouseEvent( event, evMouseAuto ) );
- else if (event.mouse.doubleClick)
- selectAll(True);
- else
- {
- anchor = mousePos(event);
- do {
- if( event.what == evMouseAuto &&
- canScroll( delta = mouseDelta(event) )
- )
- firstPos += delta;
- curPos = mousePos(event);
- if( curPos < anchor )
- {
- selStart = curPos;
- selEnd = anchor;
- }
- else
- {
- selStart = anchor;
- selEnd = curPos;
- }
- drawView();
- } while (mouseEvent(event, evMouseMove | evMouseAuto));
- }
- clearEvent(event);
- break;
- case evKeyDown:
- switch( ctrlToArrow(event.keyDown.keyCode) )
- {
- case kbLeft:
- if( curPos > 0 )
- curPos--;
- break;
- case kbRight:
- if( curPos < strlen(data) )
- curPos++;
- break;
- case kbHome:
- curPos = 0;
- break;
- case kbEnd:
- curPos = strlen(data);
- break;
- case kbBack:
- if( curPos > 0 )
- {
- strcpy( data+curPos-1, data+curPos );
- curPos--;
- if( firstPos > 0 )
- firstPos--;
- }
- break;
- case kbDel:
- if( selStart == selEnd )
- if( curPos < strlen(data) )
- {
- selStart = curPos;
- selEnd = curPos + 1;
- }
- deleteSelect();
- break;
- case kbIns:
- setState(sfCursorIns, Boolean(!(state & sfCursorIns)));
- break;
- default:
- if( event.keyDown.charScan.charCode >= ' ' )
- {
- if( (state & sfCursorIns) != 0 )
- strcpy( data + curPos, data + curPos + 1 );
- else
- deleteSelect();
- if( strlen(data) < maxLen )
- {
- if( firstPos > curPos )
- firstPos = curPos;
- memmove( data + curPos + 1, data + curPos,
- strlen(data+curPos)+1 );
- data[curPos++] =
- event.keyDown.charScan.charCode;
- }
- }
- else if( event.keyDown.charScan.charCode == CONTROL_Y)
- {
- *data = EOS;
- curPos = 0;
- }
- else
- return;
- }
- selStart = 0;
- selEnd = 0;
- if( firstPos > curPos )
- firstPos = curPos;
- i = curPos - size.x + 3;
- if( firstPos < i )
- firstPos = i;
- drawView();
- clearEvent( event );
- break;
- }
- The options word flags determine various behaviors of the view. The options
- bits are defined as follows:
-
- ofCentered = 0x300
- 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- ofSelectable = 0x001
- ofTopSelect = 0x002
- ofFirstClick = 0x004
- ofFramed = 0x008
- ofPreProcess = 0x010
- ofPostProcess = 0x020
- ofBuffered = 0x040
- ofTileable = 0x080
- ofCenterX = 0x100
- ofCenterY = 0x200
- ofHaveInput = 0x400
- Undefined = 0x800
- Undefined = 0x1000
- Undefined = 0x2000
- Undefined = 0x4000
- Undefined = 0x8000
- The following is a graphical representation of the defined and
- undefined bits in the 'TView::options' data member.
- long ios::setf(long _setbits, long _field)
- long x = x_flags;
- x_flags &= ~_field;
- x_flags |= (_setbits & _field);
- if( x_flags & ios::skipws )
- ispecial |= skipping;
- else
- ispecial &= ~skipping;
- return x;
- long TStringInputLine::setViewOpt(long setbits)
- // Define THistory ID for TStringInputLine
- const ushort hlStrInpLine = 100;
- // Look for misplaced period in the string
- char *ptr = strpbrk(data, "eE");
- if((ptr) && (strpbrk(ptr, ".")))
- invalid = True;
- = (double) atof(data);
- (ch != '-') && // and not a -...
- (ch != '+') && // and not a +...
- #if !defined __FLOAT_H
- #include <float.h>
- #endif
- TEvent event;
- // Display about box
- event.what = evCommand;
- event.message.command = cmAboutBox;
- putEvent(event);
- event.message.command = cmAboutBox;
- if( event.what == evCommand && event.message.command == cmQuit )
- {
- endModal( cmQuit );
- clearEvent( event );
- }
- ushort result = TProgram::deskTop->execView(p);
- #define LN_MAXDOUBLE 7.0978E+2
- #define LN_MINDOUBLE -7.0840E+2
- 1.797693E+308
- void
- setState(ushort aState, Boolean enable)
- if (aState == sfFocused && !enable) {
- strupr(data);
- drawView();
- TInputLine::setState(aState, enable);
- virtual void setState( ushort aState, Boolean enable );
- void
- setState(ushort aState, Boolean enable)
- if (aState == sfFocused && !enable) {
- strupr(data);
- drawView();
- TInputLine::setState(aState, enable);
- The TStringInputLine class is derived from Turbo Vision's
- TInputLine class. TStringInputLine is declared in TSTRINP.HPP,
- and defined in TSTRINP.CPP.
- This file is hereby released by the author to the public
- domain. Use it as you will.
- Author: Michael Joseph Newton
- Date: 01/17/92
- Address: 17874 Marygold Ave. #32
- Bloomington, CA 92316
- Phone: (714) 877-4655
- CompuServe: 70402,531 (as Michael J. Newton)
- RelayNet: ->ECTECH (as Mick Newton)
- All questions or comments will be greatly appreciated!
- The TStringInputLine class is derived from Turbo Vision's
- TInputLine class. TStringInputLine is declared in TSTRINP.HPP,
- and defined in TSTRINP.CPP.
- This file is hereby released by the author to the public
- domain. Use it as you will.
- Author: Michael Joseph Newton
- Date: 01/17/92
- Address: 17874 Marygold Ave. #32
- Bloomington, CA 92316
- Phone: (714) 877-4655
- CompuServe: 70402,531 (as Michael J. Newton)
- RelayNet: ->ECTECH (as Mick Newton)
- All questions or comments will be greatly appreciated!
- *new TSubMenu("~\360~", kbAltSpace, hcSystem) +
- left,D
- right,D
- string
-